package com.tdcy.framework.listener;

import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;

import com.tdcy.biz.wxmgt.service.WeixinService;
import com.tdcy.framework.util.ContextUtils;

/**
 * @title: WebStartInitListener.java
 * @package com.eastcom.modules.common.listener
 * @description: 程序启动完成打印一个日志
 *
 */
public class WebStartInitListener implements ApplicationListener<ContextRefreshedEvent> {

	@Override
	public void onApplicationEvent(ContextRefreshedEvent event) {
		WeixinService wxs = ContextUtils.getBean(WeixinService.class);
		wxs.init();

		// 需要执行的逻辑代码，当spring容器初始化完成后就会执行该方法。
		printKeyLoadMessage();
	}

	/**
	 * 获取Key加载信息
	 */
	public boolean printKeyLoadMessage() {
		StringBuilder sb = new StringBuilder();
		sb.append("\r\n======================================================================\r\n");
		sb.append("\r\n    欢迎使用 TD V1.0  - Powered by TD  \r\n");
		sb.append("\r\n======================================================================\r\n");
		System.out.println(sb.toString());
		return true;
	}
}